//
//  SharePopView.m
//  GLGW_Shoping
//
//  Created by yang on 2018/12/10.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "SharePopView.h"

@implementation SharePopView

-(id)initWithSharePopView{
    if (self = [super initWithFrame:kAppWindow.bounds inSuperView:kAppWindow]) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5];//145
        GLGWView * bankgroundView = [[GLGWView alloc] initWithFrame:CGRectMake(0, KScreenHeight, KScreenWidth, kHeightProportion_In_iPhoneTriploid(175)) inSuperView:self];
        bankgroundView.backgroundColor = [UIColor whiteColor];
        [UIView animateWithDuration:0.5 delay:0 usingSpringWithDamping:0.7 initialSpringVelocity:3 options:UIViewAnimationOptionCurveEaseIn animations:^{
            bankgroundView.frame = CGRectMake(0, KScreenHeight - kHeightProportion_In_iPhoneTriploid(175), KScreenWidth, kHeightProportion_In_iPhoneTriploid(175));
        } completion:^(BOOL finished) {
            
        }];
        //
        CGFloat butWidth = (KScreenWidth - kWidthProportion_In_iPhoneTriploid(100))/3;
        NSArray * titArr = @[@"朋友圈",@"发送给微信好友",@"邀请好友报价"];
        for (int i = 0; i<3; i++) {
            GLGWButton * but = [[GLGWButton alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(30)+butWidth*i+kWidthProportion_In_iPhoneTriploid(20)*i, kHeightProportion_In_iPhoneTriploid(15), butWidth, kHeightProportion_In_iPhoneTriploid(67)) titleLableFont:SYSTEMFONT(12) titleColor:[UIColor colorWithHexString:@"#666666"] inSuperView:bankgroundView];
            but.title = titArr[i];
            but.tag = 100+i;
            [but addTarget:self action:@selector(shareSelectAction:) forControlEvents:UIControlEventTouchUpInside];
        }
        //
        GLGWView * bottomView = [[GLGWView alloc] initWithFrame:CGRectMake(0, kHeightProportion_In_iPhoneTriploid(97), KScreenWidth, kHeightProportion_In_iPhoneTriploid(78)) inSuperView:bankgroundView];
        bottomView.backgroundColor = [UIColor colorWithHexString:@"#FAFAFA"];
        //
        GLGWButton * quxiaoBut = [[GLGWButton alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kHeightProportion_In_iPhoneTriploid(44)) titleLableFont:SYSTEMFONT(16) titleColor:kColor_Rule_Black inSuperView:bottomView];
        quxiaoBut.title = @"取消";
        quxiaoBut.tag = 103;
        [quxiaoBut addTarget:self action:@selector(shareSelectAction:) forControlEvents:UIControlEventTouchUpInside];
        //
        //
        UITapGestureRecognizer * tap_share = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap_share_Action)];
        tap_share.numberOfTouchesRequired = 1;
        tap_share.numberOfTapsRequired = 1;
        [self addGestureRecognizer:tap_share];
        self.userInteractionEnabled = YES;
    }
    return self;
}

-(void)tap_share_Action{
    [self removeFromSuperview];
}

-(void)shareSelectAction:(GLGWButton *)sender{
    if (self.Block_ShareAction) {
        self.Block_ShareAction(sender);
    }
    [self removeFromSuperview];
}
@end
